package com.zryc.service;

import com.zryc.shop.entity.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

//专门用于远程调用 shop-product 微服务,当请求失败时默认回调 ProductServiceFallback中的方法
//@FeignClient(value = "shop-product",fallback = ProductServiceFallBack.class)
@FeignClient(value = "shop-product")
public interface ProductServiceClient {
    @RequestMapping(value = "/product/{pid}",method = {RequestMethod.GET})
    Product getProd(@PathVariable("pid") Integer pid);

    @RequestMapping("/product/reduceInventory")
    public void reduceInventory(@RequestParam("pid") Integer pid, @RequestParam("num") Integer num);
}
